package Tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.math.BigDecimal;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import Chocolatier.FabricantChocolatier;
import Chocolatier.ProduitAConditionneer;

public class FabricantChocolatierTest
{
	private FabricantChocolatier fc1;

	@BeforeClass
	public static void setUpBeforeClass() throws Exception
	{
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception
	{
	}

	@Before
	public void setUp() throws Exception
	{
		fc1 = new FabricantChocolatier("Noir", 1,new BigDecimal("5.00"));
	}

	@After
	public void tearDown() throws Exception
	{
	}

	/**
	 * Checks that the Produit created is not null and is correctly filled
	 * Checks the same about the Champion inside this Produit
	 */
	@Test
	public void testCreateProduit()
	{
		
		for (int i = 0; i < 1000; i++)
		{
			assertNotNull(fc1.createProduit());
			assertEquals(fc1.getSaveurChocolat(), "Noir");
			assertEquals(fc1.getNumPoste(), 1);
			assertEquals(fc1.getPrixChocolat(), new BigDecimal("5.00"));
			ProduitAConditionneer p1 = fc1.createProduit();
			assertEquals(p1.getSaveur(), "Noir");
			assertEquals(p1.getPrix(), new BigDecimal("5.00"));
			assertNotNull(p1.getChampion());
			
		}

	}

}
